<?php namespace Phpcmf\Controllers\Member;

class Home extends \Phpcmf\Member\Module
{

	// 内容列表
	public function index() {
		$this->_Member_List();
	}
	public function pinglun() {
		\Phpcmf\Service::V()->assign([
		    'meta_title' => dr_lang('评论消息').SITE_SEOJOIN.SITE_NAME,
		    'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
		    'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
		]);
		\Phpcmf\Service::V()->display('pinglun.html');
	}
	public function dianzan() {
		\Phpcmf\Service::V()->assign([
		    'meta_title' => dr_lang('点赞消息').SITE_SEOJOIN.SITE_NAME,
		    'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
		    'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
		]);
		\Phpcmf\Service::V()->display('dianzan.html');
	}
	public function tongzhi() {
		\Phpcmf\Service::V()->assign([
		    'meta_title' => dr_lang('点赞消息').SITE_SEOJOIN.SITE_NAME,
		    'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
		    'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
		]);
		\Phpcmf\Service::V()->display('tongzhi.html');
	}
	/*public function dianzan() {
		$this->_Member_List();
	}*/
	/*public function tongzhi() {
		$this->_Member_List();
	}*/
	public function add() {
		$this->_Member_Add();
	}

	public function edit() {
		$this->_Member_Edit();
	}

	public function del() {
		$this->_Member_Del();
	}
	//一键读取系统
	public function yijianduquxingtong() {
	    $uid = (int)\Phpcmf\Service::L('input')->get('uid');
	    if (!$this->uid) {
			
			$zhuangtai = 0;
	        $msg = '您还没登录';
	        $this->_json($zhuangtai, $msg, 0);
		}
	    if(!$uid){
	        $zhuangtai = 0;
	        $msg = 'Uid 不能为空';
	        $this->_json($zhuangtai, $msg, 0);
	    }
	    $admin = $this->member['is_admin'];
	    if($admin == 1){
			//管理员 待开发
		} elseif ($uid != $this->uid) {
			$zhuangtai = 0;
	        $msg = '不是您的消息';
	        $this->_json($zhuangtai, $msg, 0);
		}
	    //系统
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 3)->where('shouxinren', $this->uid)->set('yidu', 1)->update();
		//	互加
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 7)->where('shouxinren', $this->uid)->set('yidu', 1)->update();
		//	财务
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 8)->where('shouxinren', $this->uid)->set('yidu', 1)->update();
		//问答待审
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 12)->where('shouxinren', $this->uid)->set('yidu', 1)->update();
		//问答已审
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 13)->where('shouxinren', $this->uid)->set('yidu', 1)->update();
		//问答中标状态
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 14)->where('shouxinren', $this->uid)->set('yidu', 1)->update();
		$zhuangtai = 1;
	    $msg = '一键读取成功';
	    
	    $this->_json($zhuangtai, $msg, 0);
		
	}
	//一键读取点赞
	public function yijiandianzan() {
	    $uid = (int)\Phpcmf\Service::L('input')->get('uid');
	    if (!$this->uid) {
			
			$zhuangtai = 0;
	        $msg = '您还没登录';
	        $this->_json($zhuangtai, $msg, 0);
		}
	    if(!$uid){
	        $zhuangtai = 0;
	        $msg = 'Uid 不能为空';
	        $this->_json($zhuangtai, $msg, 0);
	    }
	    $admin = $this->member['is_admin'];
	    if($admin == 1){
			//管理员 待开发
		} elseif ($uid != $this->uid) {
			
			$zhuangtai = 0;
	        $msg = '不是您的消息';
	        $this->_json($zhuangtai, $msg, 0);
		}
	    //点赞
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 4)->where('shouxinren', $this->uid)->set('yidu', 1)->update();
		$zhuangtai = 1;
	    $msg = '一键读取成功';
	    $this->_json($zhuangtai, $msg, 0);
		
	}
	//一键读取评论
	public function yijianpinglun() {
	    $uid = (int)\Phpcmf\Service::L('input')->get('uid');
	    if (!$this->uid) {
			
			$zhuangtai = 0;
	        $msg = '您还没登录';
	        $this->_json($zhuangtai, $msg, 0);
		}
	    if(!$uid){
	        $zhuangtai = 0;
	        $msg = 'Uid 不能为空';
	        $this->_json($zhuangtai, $msg, 0);
	    }
	    $admin = $this->member['is_admin'];
	    if($admin == 1){
			//管理员 待开发
		} elseif ($uid != $this->uid) {
			
			$zhuangtai = 0;
	        $msg = '不是您的消息';
	        $this->_json($zhuangtai, $msg, 0);
		}
	    //点赞
		\Phpcmf\Service::M()->db->table('1_duixin')->where('catid', 10)->where('shouxinren', $this->uid)->set('yidu', 2)->update();
		
		$zhuangtai = 1;
	    $msg = '一键读取成功';
	    
	    $this->_json($zhuangtai, $msg, 0);
		
	}
}
